\(\int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx\) [228]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F(-2)]
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 104 \[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\frac {\sqrt {a+\frac {b}{x}} x}{c}+\frac {2 \sqrt {d} \sqrt {b c-a d} \arctan \left (\frac {\sqrt {d} \sqrt {a+\frac {b}{x}}}{\sqrt {b c-a d}}\right )}{c^2}+\frac {(b c-2 a d) \text {arctanh}\left (\frac {\sqrt {a+\frac {b}{x}}}{\sqrt {a}}\right )}{\sqrt {a} c^2} \]

[Out]

(-2*a*d+b*c)*arctanh((a+b/x)^(1/2)/a^(1/2))/c^2/a^(1/2)+2*arctan(d^(1/2)*(a+b/x)^(1/2)/(-a*d+b*c)^(1/2))*d^(1/
2)*(-a*d+b*c)^(1/2)/c^2+x*(a+b/x)^(1/2)/c

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 104, normalized size of antiderivative = 1.00, number of steps used = 7, number of rules used = 6, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {382, 101, 162, 65, 214, 211} \[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\frac {2 \sqrt {d} \sqrt {b c-a d} \arctan \left (\frac {\sqrt {d} \sqrt {a+\frac {b}{x}}}{\sqrt {b c-a d}}\right )}{c^2}+\frac {\text {arctanh}\left (\frac {\sqrt {a+\frac {b}{x}}}{\sqrt {a}}\right ) (b c-2 a d)}{\sqrt {a} c^2}+\frac {x \sqrt {a+\frac {b}{x}}}{c} \]

[In]

Int[Sqrt[a + b/x]/(c + d/x),x]

[Out]

(Sqrt[a + b/x]*x)/c + (2*Sqrt[d]*Sqrt[b*c - a*d]*ArcTan[(Sqrt[d]*Sqrt[a + b/x])/Sqrt[b*c - a*d]])/c^2 + ((b*c
- 2*a*d)*ArcTanh[Sqrt[a + b/x]/Sqrt[a]])/(Sqrt[a]*c^2)

Rule 65

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_), x_Symbol] :> With[{p = Denominator[m]}, Dist[p/b, Sub
st[Int[x^(p*(m + 1) - 1)*(c - a*(d/b) + d*(x^p/b))^n, x], x, (a + b*x)^(1/p)], x]] /; FreeQ[{a, b, c, d}, x] &
& NeQ[b*c - a*d, 0] && LtQ[-1, m, 0] && LeQ[-1, n, 0] && LeQ[Denominator[n], Denominator[m]] && IntLinearQ[a,
b, c, d, m, n, x]

Rule 101

Int[((a_.) + (b_.)*(x_))^(m_)*((c_.) + (d_.)*(x_))^(n_.)*((e_.) + (f_.)*(x_))^(p_.), x_Symbol] :> Simp[(a + b*
x)^(m + 1)*(c + d*x)^n*((e + f*x)^(p + 1)/((m + 1)*(b*e - a*f))), x] - Dist[1/((m + 1)*(b*e - a*f)), Int[(a +
b*x)^(m + 1)*(c + d*x)^(n - 1)*(e + f*x)^p*Simp[d*e*n + c*f*(m + p + 2) + d*f*(m + n + p + 2)*x, x], x], x] /;
 FreeQ[{a, b, c, d, e, f, p}, x] && LtQ[m, -1] && GtQ[n, 0] && (IntegersQ[2*m, 2*n, 2*p] || IntegersQ[m, n + p
] || IntegersQ[p, m + n])

Rule 162

Int[(((e_.) + (f_.)*(x_))^(p_)*((g_.) + (h_.)*(x_)))/(((a_.) + (b_.)*(x_))*((c_.) + (d_.)*(x_))), x_Symbol] :>
 Dist[(b*g - a*h)/(b*c - a*d), Int[(e + f*x)^p/(a + b*x), x], x] - Dist[(d*g - c*h)/(b*c - a*d), Int[(e + f*x)
^p/(c + d*x), x], x] /; FreeQ[{a, b, c, d, e, f, g, h}, x]

Rule 211

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]/a)*ArcTan[x/Rt[a/b, 2]], x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 214

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[-a/b, 2]/a)*ArcTanh[x/Rt[-a/b, 2]], x] /; FreeQ[{a, b},
x] && NegQ[a/b]

Rule 382

Int[((a_) + (b_.)*(x_)^(n_))^(p_.)*((c_) + (d_.)*(x_)^(n_))^(q_.), x_Symbol] :> -Subst[Int[(a + b/x^n)^p*((c +
 d/x^n)^q/x^2), x], x, 1/x] /; FreeQ[{a, b, c, d, p, q}, x] && NeQ[b*c - a*d, 0] && ILtQ[n, 0]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {\sqrt {a+b x}}{x^2 (c+d x)} \, dx,x,\frac {1}{x}\right ) \\ & = \frac {\sqrt {a+\frac {b}{x}} x}{c}-\frac {\text {Subst}\left (\int \frac {\frac {1}{2} (b c-2 a d)-\frac {b d x}{2}}{x \sqrt {a+b x} (c+d x)} \, dx,x,\frac {1}{x}\right )}{c} \\ & = \frac {\sqrt {a+\frac {b}{x}} x}{c}-\frac {(b c-2 a d) \text {Subst}\left (\int \frac {1}{x \sqrt {a+b x}} \, dx,x,\frac {1}{x}\right )}{2 c^2}+\frac {(d (b c-a d)) \text {Subst}\left (\int \frac {1}{\sqrt {a+b x} (c+d x)} \, dx,x,\frac {1}{x}\right )}{c^2} \\ & = \frac {\sqrt {a+\frac {b}{x}} x}{c}-\frac {(b c-2 a d) \text {Subst}\left (\int \frac {1}{-\frac {a}{b}+\frac {x^2}{b}} \, dx,x,\sqrt {a+\frac {b}{x}}\right )}{b c^2}+\frac {(2 d (b c-a d)) \text {Subst}\left (\int \frac {1}{c-\frac {a d}{b}+\frac {d x^2}{b}} \, dx,x,\sqrt {a+\frac {b}{x}}\right )}{b c^2} \\ & = \frac {\sqrt {a+\frac {b}{x}} x}{c}+\frac {2 \sqrt {d} \sqrt {b c-a d} \tan ^{-1}\left (\frac {\sqrt {d} \sqrt {a+\frac {b}{x}}}{\sqrt {b c-a d}}\right )}{c^2}+\frac {(b c-2 a d) \tanh ^{-1}\left (\frac {\sqrt {a+\frac {b}{x}}}{\sqrt {a}}\right )}{\sqrt {a} c^2} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.32 (sec) , antiderivative size = 100, normalized size of antiderivative = 0.96 \[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\frac {c \sqrt {a+\frac {b}{x}} x+2 \sqrt {d} \sqrt {b c-a d} \arctan \left (\frac {\sqrt {d} \sqrt {a+\frac {b}{x}}}{\sqrt {b c-a d}}\right )+\frac {(b c-2 a d) \text {arctanh}\left (\frac {\sqrt {a+\frac {b}{x}}}{\sqrt {a}}\right )}{\sqrt {a}}}{c^2} \]

[In]

Integrate[Sqrt[a + b/x]/(c + d/x),x]

[Out]

(c*Sqrt[a + b/x]*x + 2*Sqrt[d]*Sqrt[b*c - a*d]*ArcTan[(Sqrt[d]*Sqrt[a + b/x])/Sqrt[b*c - a*d]] + ((b*c - 2*a*d
)*ArcTanh[Sqrt[a + b/x]/Sqrt[a]])/Sqrt[a])/c^2

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(231\) vs. \(2(86)=172\).

Time = 0.22 (sec) , antiderivative size = 232, normalized size of antiderivative = 2.23

method result size
risch \(\frac {x \sqrt {\frac {a x +b}{x}}}{c}-\frac {\left (\frac {\left (2 a d -b c \right ) \ln \left (\frac {\frac {b}{2}+a x}{\sqrt {a}}+\sqrt {a \,x^{2}+b x}\right )}{c \sqrt {a}}+\frac {2 \left (a d -b c \right ) d \ln \left (\frac {\frac {2 \left (a d -b c \right ) d}{c^{2}}-\frac {\left (2 a d -b c \right ) \left (x +\frac {d}{c}\right )}{c}+2 \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}\, \sqrt {a \left (x +\frac {d}{c}\right )^{2}-\frac {\left (2 a d -b c \right ) \left (x +\frac {d}{c}\right )}{c}+\frac {\left (a d -b c \right ) d}{c^{2}}}}{x +\frac {d}{c}}\right )}{c^{2} \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}}\right ) \sqrt {\frac {a x +b}{x}}\, \sqrt {x \left (a x +b \right )}}{2 c \left (a x +b \right )}\) \(232\)
default \(-\frac {\sqrt {\frac {a x +b}{x}}\, x \left (2 a^{\frac {3}{2}} \ln \left (\frac {2 \sqrt {x \left (a x +b \right )}\, \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}\, c -2 a d x +b c x -b d}{c x +d}\right ) d^{2}-2 \sqrt {x \left (a x +b \right )}\, c^{2} \sqrt {a}\, \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}-2 \sqrt {a}\, \ln \left (\frac {2 \sqrt {x \left (a x +b \right )}\, \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}\, c -2 a d x +b c x -b d}{c x +d}\right ) b c d +2 \ln \left (\frac {2 \sqrt {x \left (a x +b \right )}\, \sqrt {a}+2 a x +b}{2 \sqrt {a}}\right ) \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}\, a c d -\ln \left (\frac {2 \sqrt {x \left (a x +b \right )}\, \sqrt {a}+2 a x +b}{2 \sqrt {a}}\right ) \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}\, b \,c^{2}\right )}{2 \sqrt {x \left (a x +b \right )}\, c^{3} \sqrt {a}\, \sqrt {\frac {\left (a d -b c \right ) d}{c^{2}}}}\) \(287\)

[In]

int((a+b/x)^(1/2)/(c+d/x),x,method=_RETURNVERBOSE)

[Out]

1/c*x*((a*x+b)/x)^(1/2)-1/2/c*((2*a*d-b*c)/c*ln((1/2*b+a*x)/a^(1/2)+(a*x^2+b*x)^(1/2))/a^(1/2)+2*(a*d-b*c)*d/c
^2/((a*d-b*c)*d/c^2)^(1/2)*ln((2*(a*d-b*c)*d/c^2-(2*a*d-b*c)/c*(x+d/c)+2*((a*d-b*c)*d/c^2)^(1/2)*(a*(x+d/c)^2-
(2*a*d-b*c)/c*(x+d/c)+(a*d-b*c)*d/c^2)^(1/2))/(x+d/c)))*((a*x+b)/x)^(1/2)*(x*(a*x+b))^(1/2)/(a*x+b)

Fricas [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 482, normalized size of antiderivative = 4.63 \[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\left [\frac {2 \, a c x \sqrt {\frac {a x + b}{x}} - {\left (b c - 2 \, a d\right )} \sqrt {a} \log \left (2 \, a x - 2 \, \sqrt {a} x \sqrt {\frac {a x + b}{x}} + b\right ) + 2 \, \sqrt {-b c d + a d^{2}} a \log \left (\frac {b d - {\left (b c - 2 \, a d\right )} x + 2 \, \sqrt {-b c d + a d^{2}} x \sqrt {\frac {a x + b}{x}}}{c x + d}\right )}{2 \, a c^{2}}, \frac {2 \, a c x \sqrt {\frac {a x + b}{x}} - 4 \, \sqrt {b c d - a d^{2}} a \arctan \left (\frac {\sqrt {b c d - a d^{2}} x \sqrt {\frac {a x + b}{x}}}{a d x + b d}\right ) - {\left (b c - 2 \, a d\right )} \sqrt {a} \log \left (2 \, a x - 2 \, \sqrt {a} x \sqrt {\frac {a x + b}{x}} + b\right )}{2 \, a c^{2}}, \frac {a c x \sqrt {\frac {a x + b}{x}} - {\left (b c - 2 \, a d\right )} \sqrt {-a} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a x + b}{x}}}{a}\right ) + \sqrt {-b c d + a d^{2}} a \log \left (\frac {b d - {\left (b c - 2 \, a d\right )} x + 2 \, \sqrt {-b c d + a d^{2}} x \sqrt {\frac {a x + b}{x}}}{c x + d}\right )}{a c^{2}}, \frac {a c x \sqrt {\frac {a x + b}{x}} - 2 \, \sqrt {b c d - a d^{2}} a \arctan \left (\frac {\sqrt {b c d - a d^{2}} x \sqrt {\frac {a x + b}{x}}}{a d x + b d}\right ) - {\left (b c - 2 \, a d\right )} \sqrt {-a} \arctan \left (\frac {\sqrt {-a} \sqrt {\frac {a x + b}{x}}}{a}\right )}{a c^{2}}\right ] \]

[In]

integrate((a+b/x)^(1/2)/(c+d/x),x, algorithm="fricas")

[Out]

[1/2*(2*a*c*x*sqrt((a*x + b)/x) - (b*c - 2*a*d)*sqrt(a)*log(2*a*x - 2*sqrt(a)*x*sqrt((a*x + b)/x) + b) + 2*sqr
t(-b*c*d + a*d^2)*a*log((b*d - (b*c - 2*a*d)*x + 2*sqrt(-b*c*d + a*d^2)*x*sqrt((a*x + b)/x))/(c*x + d)))/(a*c^
2), 1/2*(2*a*c*x*sqrt((a*x + b)/x) - 4*sqrt(b*c*d - a*d^2)*a*arctan(sqrt(b*c*d - a*d^2)*x*sqrt((a*x + b)/x)/(a
*d*x + b*d)) - (b*c - 2*a*d)*sqrt(a)*log(2*a*x - 2*sqrt(a)*x*sqrt((a*x + b)/x) + b))/(a*c^2), (a*c*x*sqrt((a*x
 + b)/x) - (b*c - 2*a*d)*sqrt(-a)*arctan(sqrt(-a)*sqrt((a*x + b)/x)/a) + sqrt(-b*c*d + a*d^2)*a*log((b*d - (b*
c - 2*a*d)*x + 2*sqrt(-b*c*d + a*d^2)*x*sqrt((a*x + b)/x))/(c*x + d)))/(a*c^2), (a*c*x*sqrt((a*x + b)/x) - 2*s
qrt(b*c*d - a*d^2)*a*arctan(sqrt(b*c*d - a*d^2)*x*sqrt((a*x + b)/x)/(a*d*x + b*d)) - (b*c - 2*a*d)*sqrt(-a)*ar
ctan(sqrt(-a)*sqrt((a*x + b)/x)/a))/(a*c^2)]

Sympy [F]

\[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\int \frac {x \sqrt {a + \frac {b}{x}}}{c x + d}\, dx \]

[In]

integrate((a+b/x)**(1/2)/(c+d/x),x)

[Out]

Integral(x*sqrt(a + b/x)/(c*x + d), x)

Maxima [F]

\[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\int { \frac {\sqrt {a + \frac {b}{x}}}{c + \frac {d}{x}} \,d x } \]

[In]

integrate((a+b/x)^(1/2)/(c+d/x),x, algorithm="maxima")

[Out]

integrate(sqrt(a + b/x)/(c + d/x), x)

Giac [F(-2)]

Exception generated. \[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\text {Exception raised: TypeError} \]

[In]

integrate((a+b/x)^(1/2)/(c+d/x),x, algorithm="giac")

[Out]

Exception raised: TypeError >> an error occurred running a Giac command:INPUT:sage2:=int(sage0,sageVARx):;OUTP
UT:Error: Bad Argument Type

Mupad [B] (verification not implemented)

Time = 5.74 (sec) , antiderivative size = 149, normalized size of antiderivative = 1.43 \[ \int \frac {\sqrt {a+\frac {b}{x}}}{c+\frac {d}{x}} \, dx=\frac {x\,\sqrt {a+\frac {b}{x}}}{c}+\frac {\ln \left (\sqrt {a+\frac {b}{x}}-\sqrt {a}\right )\,\left (a\,d-\frac {b\,c}{2}\right )}{\sqrt {a}\,c^2}-\frac {\ln \left (\sqrt {a+\frac {b}{x}}+\sqrt {a}\right )\,\left (2\,a\,d-b\,c\right )}{2\,\sqrt {a}\,c^2}-\frac {\mathrm {atan}\left (\frac {b^4\,d^3\,\sqrt {a+\frac {b}{x}}\,\sqrt {a\,d^2-b\,c\,d}\,4{}\mathrm {i}}{4\,a\,b^4\,d^4-4\,b^5\,c\,d^3}\right )\,\sqrt {a\,d^2-b\,c\,d}\,2{}\mathrm {i}}{c^2} \]

[In]

int((a + b/x)^(1/2)/(c + d/x),x)

[Out]

(x*(a + b/x)^(1/2))/c - (atan((b^4*d^3*(a + b/x)^(1/2)*(a*d^2 - b*c*d)^(1/2)*4i)/(4*a*b^4*d^4 - 4*b^5*c*d^3))*
(a*d^2 - b*c*d)^(1/2)*2i)/c^2 + (log((a + b/x)^(1/2) - a^(1/2))*(a*d - (b*c)/2))/(a^(1/2)*c^2) - (log((a + b/x
)^(1/2) + a^(1/2))*(2*a*d - b*c))/(2*a^(1/2)*c^2)